package info.liuxing.bean;

import java.util.Date;

public class Person2 {

    private String name;

    private Integer age;

    private Date createdAt;

    public Person2() {
    }

    public Person2(String name, int age) {
        this.name = name;
        this.age = age;
        this.createdAt = new Date();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"name\":\"")
                .append(name).append('\"');
        sb.append(",\"age\":")
                .append(age);
        sb.append(",\"createdAt\":\"")
                .append(createdAt.getTime()).append('\"');
        sb.append('}');
        return sb.toString();
    }
}
